﻿using PdfSdk.Pdf;

namespace PdfSdk
{
    internal class PdfPrimitiveHelper
    {
        public static IPdfPrimitiveWrapper GetPrimitiveWrapper(object obj)
        {
            if (obj == null)
                return null;

            return obj.GetType().Name switch
            {
                "PdfDictionary" => new PdfDictionaryWrapper(obj),
                "PdfStream" => new PdfStreamWrapper(obj),
                "PdfArray" => new PdfArrayWrapper(obj),
                "PdfNumber" => new PdfNumberWrapper(obj),
                "PdfBoolean" => new PdfBooleanWrapper(obj),
                "PdfString" => new PdfStringWrapper(obj),
                "PdfName" => new PdfNameWrapper(obj),
                "PdfReference" => new PdfReferenceWrapper(obj),
                "PdfReferenceHolder" => new PdfReferenceHolderWrapper(obj),
                "PdfNull" => new PdfNullWrapper(obj),
                _ => null,
            };
        }
    }
}
